package co.fitstart.admin.dao;

import com.demo2do.core.persistence.annotation.Dynamic;
import com.demo2do.core.persistence.annotation.Execute;
import com.demo2do.core.persistence.annotation.Query;
import com.demo2do.core.persistence.annotation.Variable;
import co.fitstart.entity.principal.ServiceQrcode;

/**
 * 
 * @author wangliwang
 *
 */
@Dynamic("hibernate")
public interface ServiceQrcodeDao {
    
    /**
     * load serviceQrcode by alias
     * 
     * @param alias
     * @return
     */
    @Query("FROM ServiceQrcode qrcode WHERE qrcode.disabled = false and qrcode.alias =:alias")
    public ServiceQrcode load(@Variable("alias") String alias);
    
    /**
     * change qrcode status by qrcodeId
     * 
     * @param qrcodeId
     */
    @Execute("UPDATE ServiceQrcode qrcode SET qrcode.disabled = true WHERE qrcode.id = :qrcodeId")
    public void changeStatus(@Variable("qrcodeId") Long qrcodeId);
}
